cmake_minimum_required(VERSION 3.10)
project(ballDetect)

#设置c++标准
set(CMAKE_CXX_STANDARD 20)

#设置输出目录
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

# 设置构建类型（二选一）
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Default build type" FORCE)
#set(CMAKE_BUILD_TYPE Release CACHE STRING "Default build type" FORCE)

# 设置编译器标志
#set(CMAKE_C_FLAGS_RELEASE  "${CMAKE_C_FLAGS_RELEASE} -w -O3 -march=native")
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -w -O3 -march=native")
#set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -g -march=native")
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -g -march=native")


find_package(OpenCV REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(Eigen3 REQUIRED)



include_directories(${OpenCV_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} ./src/camera ./src/param ./src/control ./src/detect)
include_directories("/usr/include/eigen3")

add_subdirectory(src)

add_executable(ballDetect main.cpp
        src/detect/detector.cpp
        src/detect/detector.h
)

#yaml-cpp要在param（使用yaml库）之后链接。否则会出问题
target_link_libraries(ballDetect
        ${OpenCV_LIBS}
        control
        param
        camera
        pthread
        yaml-cpp
)
